package com.lc.rongzecaifu.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.rongzecaifu.MyApplication;
import com.lc.rongzecaifu.conn.JsonBorrowout;
import com.lc.rongzecaifu.rongzecaifu.R;
import com.zcx.helper.bound.BoundViewHelper;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;


/**
 * Created by Administrator on 4/13/2016.
 */
public class BorrowingLiubiaoAdapter extends RecyclerView.Adapter<BorrowingLiubiaoAdapter.ViewHolder> {


    private Context context;
    private List<JsonBorrowout.Info.ListContent> list;


    public BorrowingLiubiaoAdapter(Context context, List<JsonBorrowout.Info.ListContent> list) {
        this.context = context;
        this.list = list;

    }


    public static class ViewHolder extends RecyclerView.ViewHolder {


        @Bind(R.id.tv_02)
        TextView tv_02;

        @Bind(R.id.tv_03)
        TextView tv_03;
        @Bind(R.id.progress)
        TextView progress;

        @Bind(R.id.money)
        TextView money;
        @Bind(R.id.tv_time)
        TextView tv_time;


        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }


    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = BoundViewHelper.boundView(this, MyApplication.scaleScreenHelper.loadView((ViewGroup) LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_liubiao_already, null)));
        // set the view's size, margins, paddings and layout parameters
        BorrowingLiubiaoAdapter.ViewHolder vh = new BorrowingLiubiaoAdapter.ViewHolder(view);

        return vh;

    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tv_02.setText(list.get(position).borrow_name);
        holder.tv_03.setText(list.get(position).repayment_type_cn);


        holder.progress.setText(list.get(position).progress);

        holder.money.setText(list.get(position).borrow_money);
        holder.tv_time.setText(list.get(position).add_time);
        //还款明细
        //  holder.tv_time_detail.setText(list.get(position).tv_time_detail);
        //   holder.tv_qixian.setText(list.get(position).tv_qixian);

       /* @Bind(R.id.tv_02)
        TextView tv_02;

        @Bind(R.id.tv_03)
        TextView tv_03;
        @Bind(R.id.progress)
        TextView   progress;

        @Bind(R.id.money)
        TextView   money;
        @Bind(R.id.tv_time)
        TextView   tv_time;*/
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
}
